package com.wanlian.util;

import java.util.ArrayList;
import java.util.List;

import com.wanlian.json.JsonStringUtil;

public class InvokeDescripsion {

    private Class<?> tagClass;

    private String methodName;

    private List<ClassDescripsion> params;

    public InvokeDescripsion() {

    }

    public InvokeDescripsion(Class<?> tagClass, String methodName, Object param) {
        this.setTagClass(tagClass);
        this.setMethodName(methodName);
        this.params = new ArrayList<ClassDescripsion>();
        this.params.add(getParamMap(param));
    }

    private ClassDescripsion getParamMap(Object param) {
        ClassDescripsion sourceclass = new ClassDescripsion();
        String ovalue = JsonStringUtil.writeValueAsString(param);
        String typename = param.getClass().getTypeName();
        sourceclass.setTypeName(typename);
        sourceclass.setTypeValue(ovalue);
        return sourceclass;
    }

    public Class<?> getTagClass() {
        return tagClass;
    }

    public void setTagClass(Class<?> tagClass) {
        this.tagClass = tagClass;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public List<ClassDescripsion> getParams() {
        return params;
    }

    public void setParams(List<ClassDescripsion> params) {
        this.params = params;
    }

}
